package com.qding.park.adapter.report.valid;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import org.apache.commons.lang3.StringUtils;

public class CardTypeValid implements ConstraintValidator<CardType, String>{
    
    private CardType constraintAnnotation;
    
    @Override
    public void initialize(CardType constraintAnnotation) {
        this.constraintAnnotation=constraintAnnotation;
    }
    
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
       
        if(StringUtils.isBlank(value)){
            return false;
        }
        
        if("fixed-property".equals(value)){
            return true;
        }else if("lease-property".equals(value)){
            return true;
        }else if("month-credit".equals(value)){
            return true;
        }else if("number-credit".equals(value)){
            return true;
        }else if("time-credit".equals(value)){
            return true;
        }else if("temp".equals(value)){
            return true;
        }
        return false;
    }

}
